package org.neurone.userspace.dao;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import org.neurone.domain.Message;
import org.neurone.domain.alter.MessageAlter;
import org.neurone.util.criteria.Criteria;

public class MessageDaoMock implements MessageDao {
	private HashMap<Long, Message> messageList;
	
	public MessageDaoMock()
	{
		this.messageList = new HashMap<Long, Message>();
	}
	
	@Override
	public void deleteMessage(Long messageID) {
		this.messageList.remove(messageID);
	}

	@Override
	public Message find(Long messageID) {
		// TODO Auto-generated method stub
		return this.messageList.get(messageID);
	}

	@Override
	public List<Message> findAll(String messageType, int pageSize, int pageIndex) {
		// TODO Auto-generated method stub
		return new ArrayList<Message>(this.messageList.values());
	}

	@Override
	public Long newMessage(Message message) {
		// TODO Auto-generated method stub
		this.messageList.put(message.getMessageID(), message);
		return message.getMessageID();
	}

	@Override
	public void updateMessage(Message message) {
		this.messageList.put(message.getMessageID(), message);
	}

	@Override
	public List<Message> search(Criteria terms, int pageSize, int pageIndex) {
		// TODO Auto-generated method stub
		return new ArrayList<Message>(this.messageList.values());
	}

}
